﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace 建设项目数据爬取
{
    internal class Helper
    {
        public static Helper Instance;
        private static readonly object padlock = new object();
        public static Helper GetInstance()
        {
            lock (padlock) 
            {
                if (Instance == null)
                {
                    Instance = new Helper();
                }
                return Instance;
            }
        }

        public static void Log(string LogFilePath, Exception exception)
        {
            if (exception == null)
            {
                File.AppendAllText(LogFilePath, "\n" + exception.Message);
            }
        }

        public static async void ShowMessage(string content, string title)
        {
            await Task.Run(() => { MessageBox.Show(content, title); });
        }
    }
}
